package wanyi.algorithm.basic.analysisAnddesign.chapter1;

public class Chapter2 {
	
	//calculate factorial
	public static int factorial (int n) {
		if (n == 1) return 1;
		else {
			return n * factorial (n - 1);
		}
	}
	
	//calculate Fibonacci
	public static int fibonacci (int n) {
		if (n <= 1) return 1;
		else {
			return fibonacci (n -1 ) + factorial(n - 2);
		}
	}
	
	
}
